Smooth Git + P4Merge 您所在的位置:网站首页 p4merge windows Smooth Git + P4Merge

Smooth Git + P4Merge

2023-06-17 09:40| 来源: 网络整理| 查看: 265

Smooth Git + P4merge

For a couple of year, I鈥檝e been using P4Merge as my Git diff/merge tool.

Generally speaking, I鈥檓 exclusively using Git CLI because I鈥檝e witnessed people who insist on using GUI frontends seem to stagnate on the Git learning curve.

Nevertheless, I appreciate working with a visual diff/merge tool in the following situations:

comparing branches/sha1s content: $ git difftool A..B [...] resolving merge conflicts: $ git mergetool [...]

To improve my experience, I wrote a p4merge launcher script I鈥檓 sharing with you.

The script exists in 3 versions: Windows, Linux and Mac. Compared to invoking P4Merge directly, it irons out small discrepancies:

P4Merge on Windows doesn鈥檛 support /dev/null P4Merge on Mac works better with the provided launchp4merge launcher and absolute paths When dealing with submodules, Git up to 1.9.1 feeds the submodule directory in the external diff driver instead of creating a temporary file containing "Subproject commit $sha" Windows instructions

Save the following p4merge file in the C:\Program Files (x86)\Git\bin directory.

Then, from within Git Bash, issue the following commands:

$ chmod +x '/c/Program Files (x86)/Git/bin/p4merge' $ git config --global merge.tool p4merge $ git config --global mergetool.keepTemporaries false $ git config --global mergetool.prompt false Linux instructions

Save the following p4merge file in the /usr/local/bin directory.

Then, from within Bash, issue the following commands:

$ chmod +x '/usr/local/bin/p4merge' $ git config --global merge.tool p4merge $ git config --global mergetool.keepTemporaries false $ git config --global mergetool.prompt false

The script assumes P4Merge is installed in /opt/p4v.

Mac instructions

Save the following p4merge file in the /usr/local/bin directory.

Then, from within Bash, issue the following commands:

$ chmod +x '/usr/local/bin/p4merge' $ git config --global merge.tool p4merge $ git config --global mergetool.keepTemporaries false $ git config --global mergetool.prompt false

Hope that helps!



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有